﻿using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace TK.Test
{
/// <summary>
/// 
/// </summary>
public class SystemInfo:MonoBehaviour
{
        public Text text;

        private float t1 = 1.5f;
        private float t2 = 0f;
        private int count = 0;
        private float fps = 0f;

        public int Age { get; set; }

        void getFPS()
        {
            count++;
            t2 += Time.deltaTime;
            if(t2 >= t1)
            {
                fps = count / t2;
                t2 = 0;
                count = 0;
                
            }
        }

        private void Start()
        {
            Application.targetFrameRate = 60;
        }

        private void Update()
        {
            getFPS();
            string str = "";
            str += "当前平台：" +  Application.platform + "\r\n";
            str += "屏幕DPI:" + Screen.dpi + "\r\n";
            str += "屏幕宽高:" + Screen.width + " x " + Screen.height + "\r\n";
            str += "FPS:" + fps + "\r\n";
            str += "FPS2:" + Application.targetFrameRate + "\r\n";
            text.text = str;
        }
    }
}

